<%--
$Id: article-editNew.jsp 13 2010-11-02 15:35:59Z feigme $
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/content/commons/taglibs.jsp" %>
<%@ taglib uri="http://java.fckeditor.net" prefix="FCK" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>New Article</title>	
</head>
<body>
    <form action="${ctx}/article/new" method="post">
    <table width="100%">
    	<tr>
    		<td><fmt:message key="article.title"/></td>
    		<td><input name="title" type="text" size="50"/></td>
    	</tr>
    	<tr>
    		<td><fmt:message key="article.category.name"/></td>
    		<td>
    			<input type="radio" name="categoryType" value="1" checked="checked"/><fmt:message key="article.category.select"/>
    			<input type="radio" name="categoryType" value="2"/><fmt:message key="article.category.new"/>
    		</td>
    	</tr>
    	<tr>
    		<td></td>
    		<td>
    			<select id="categorySelect" name="categoryId" style="display: block;">
    				<option style="width:80px;"></option>
    				<c:if test="${categorys!=null}">
	    				<c:forEach var="cat" items="${categorys}">
	    				<option value="${cat.id }">${cat.name }</option>
	    				</c:forEach>
    				</c:if>
    			</select>
    			<input id="categoryName" type="text" name="categoryName" style="display: none;"/>
    		</td>
    	</tr>
    	<tr>
    		<td><fmt:message key="article.description"/></td>
    		<td><textarea name="description" rows="3" cols="50"></textarea></td>
    	</tr>
    	<tr>
    		<td><fmt:message key="article.content"/></td>
    		<td>
    			<FCK:editor toolbarSet="edit_1" instanceName="EditorDefault" value="" height="500" inputName="content" basePath="/fckeditor"> 
            	</FCK:editor>  
    		</td>
    	</tr>
        <tr>
            <td colspan="2" align="center">
                <button type="submit"><fmt:message key="common.submit"/></button>
            </td>
        </tr>
    </table>
    </form>  
<script type="text/javascript">
$(document).ready(function(){
	$("input[name='categoryType']").click(function() {
		if(this.value==1){
			$("#categorySelect").show();
			$("#categoryName").hide();
		}
		if(this.value==2){
			$("#categorySelect").hide();
			$("#categoryName").show();
		}
    });
});
</script>    
</body>
</html>
	